<?php

namespace Mediacosmos\UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use PUGX\MultiUserBundle\Validator\Constraints\UniqueEntity;


/**
 * @ORM\Entity
 * @ORM\Table(name="artist")
 * @UniqueEntity(fields = "username", targetClass = "Mediacosmos\UserBundle\Entity\User", message="fos_user.username.already_used")
 * @UniqueEntity(fields = "email", targetClass = "Mediacosmos\UserBundle\Entity\User", message="fos_user.email.already_used")
 */
class Artist extends Member{

     /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
    
    /**
     * @ORM\ManyToMany(targetEntity="Mediacosmos\ConsultationBundle\Entity\Battle", cascade={"persist"})
     */
    private $battles;

    /**
     * Constructor
     */
    public function __construct()
    {
        parent::__construct();
        $this->battles = new \Doctrine\Common\Collections\ArrayCollection();
        $this->removeRole("ROLE_MEMBER");
        $this->addRole("ROLE_ARTIST");
    }

    /**
     * Add battles
     *
     * @param \Mediacosmos\ConsultationBundle\Entity\Battle $battles
     * @return Artist
     */
    public function addBattle(\Mediacosmos\ConsultationBundle\Entity\Battle $battles)
    {
        $this->battles[] = $battles;

        return $this;
    }

    /**
     * Remove battles
     *
     * @param \Mediacosmos\ConsultationBundle\Entity\Battle $battles
     */
    public function removeBattle(\Mediacosmos\ConsultationBundle\Entity\Battle $battles)
    {
        $this->battles->removeElement($battles);
    }

    /**
     * Get battles
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getBattles()
    {
        return $this->battles;
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
    
}
